<?php
$index = 1;
$page = (intval($this->uri->segment(4)));
if($page<=1)
    $page=0;
?>
<div>
    <?= $message ?>
</div>
<div class="module">
    <h2><span><?= $subtitle ?></span></h2>
    <div class="module-table-body">
        <form action="">
            <table id="myTable" class="tablesorter">
                <thead>
                    <tr>
                        <th style="width:5%">#</th>
                        <th>Tên danh mục</th>
                        <th style="width:15%">Thứ tự hiển thị</th>
                        <th style="width:15%">Cho phép hiển thị</th>
                        <th style="width:15%">Danh Mục Cha</th>
                        <th style="width:15%"></th>
                    </tr>
                </thead>
                <tbody>
                <?php  if(count($list)>0): ?>
                <?php foreach($list as $item ):?>
                    <tr>
                        <td class="align-center"><?= $index+$page ?></td>
                        <td valign="top">
                            <a href="<?= HOME_PAGE. ADMIN_PAGE_CATEGORY_EDIT.'/'.$item->category_id ?>"><?= $item->category_name ?></a>
                        </td>
                        <td><?= $item->category_order ?></td>
                        <td><?= $item->category_display_state == 1?'Có':'Không' ?></td>
                        <td><?= $item->category_parent_name ?></td>
                        <td>
                            <a href="<?= HOME_PAGE. ADMIN_PAGE_CATEGORY_EDIT.'/'.$item->category_id ?>"><img src="<?= ADMIN_IMG ?>pencil.gif" width="16" height="16" alt="edit" /> cập nhật</a>
                            <a href="<?= HOME_PAGE. ADMIN_PAGE_CATEGORY_DEL . '/'.$item->category_id ?>" onclick="return confirm('Bạn có chắc chắn muốn xoá danh mục này không?');"><img src="<?= ADMIN_IMG ?>minus-circle.gif" width="16" height="16" alt="delete" /> xoá</a>
                        </td>
                    </tr>
                    <?php $index++; ?>
                    <?php endforeach ?>
                    <?php endif ?>
                </tbody>
            </table>
        </form>
        <div class="pager" id="pager">
        </div>
        <div class="table-apply">
        </div>
        <div style="clear: both"></div>
    </div> <!-- End .module-table-body -->
</div> <!-- End .module -->
<div class="paging">
        <?= $this->pagination->create_links(); ?>
</div>